﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace AKMII.DMRA.Web.Controls
{
    public partial class ChangePasswordDiv : System.Web.UI.UserControl
    {
        public EventHandler OnUpdateClick;
        public EventHandler OnCancelClick;

        public string Message
        {
            get { return lblMsg.Text; }
            set { lblMsg.Text = value; }
        }

        public string Password
        {
            get
            {
                if(!string.IsNullOrEmpty(txtNewPassword.Text.Trim()) &&
                    !string.IsNullOrEmpty(txtConfirmPassword.Text.Trim()))
                {
                    if (txtNewPassword.Text == txtConfirmPassword.Text)
                    {
                        return txtNewPassword.Text;
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    return null;
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (OnUpdateClick != null)
            {
                OnUpdateClick(sender, e);
            }
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            if (OnCancelClick != null)
            {
                OnCancelClick(sender, e);
            }
        }
    }
}